package cn.snow.boot.service;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service;

/**
 * @author liuwanxiang
 * @version 2018/09/13
 */
@Service
public class PublisherService {

    private static final Logger log = LoggerFactory.getLogger(PublisherService.class);

    @Autowired
    private StringRedisTemplate stringRedisTemplate;

    public String publish(String string) {

        if ("1".equals(string)){
            stringRedisTemplate.convertAndSend("phone","18888888888");
            log.info("Publisher sendes Topic... ");
            return "success";
        }else {
            return "no my phone";
        }

    }
}
